<?php
/**
 * Created by jinqiang on 2024/6/20 17:51.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Repository;


use App\Http\Models\Mysql\SsyNewProductsLogTable;
use App\Http\Models\Mysql\SsyPushOmsJavaLogTable;

class LogRepository
{
    //操作日志
    public static function setOperateLog($name, $content, $typeNo, $type, $data = [])
    {
        $data = [
            'username' => $name,
            'content' => $content,
            'type_no' => $typeNo,
            'type' => $type,//1运营订单 2加工单 3核价单 4设计档案 5尺寸表 6工艺单 8技术文件 9物料清单 10大货BOM 11绣花BOM
            'data' => !empty($data) ? json_encode($data, JSON_UNESCAPED_UNICODE) : null,
            'createtime' => date('Y-m-d H:i:s'),
        ];
        (new SsyNewProductsLogTable())->createData($data);
    }

    //采购单推送日志
    public static function setJuyiPushLog($content, $group, $title, $addUser)
    {
        $saveData = [
            'datalist' => $content,
            'group' => $group,//1 创建供应商 2创建采购入库单 3 出库单
            'title' => $title,
            'adduser' => $addUser,
            'createtime' => date('Y-m-d H:i:s')
        ];
        (new SsyPushOmsJavaLogTable())->createData($saveData);
    }
}
